<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>已分配班级的用户</title>
		<link rel="stylesheet" type="text/css" href="css/qingjia.css">
		<link rel="stylesheet" type="text/css" href="css/admin.css">
		<script type="text/javascript" src="js/vue.js"></script>
		<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
		<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
	</head>
	<body>
		
		<div id="container">
			<div id="menu">

				<div class="menu-level-0">给用户分配角色</div>
				<div class="menu-level-1"><a href="admin-yifenpeijuese.html">已分配角色的用户</a></div>
				<div class="menu-level-1"><a href="admin-fenpeibanji.html">给用户分配班级</a></div>
				<div class="menu-level-1"><a href="admin-yifenpeibanji.html">已分配班级的用户</a></div>
				<div class="menu-level-1"><a href="admin.html">给班级分配老师</a></div>
				<div class="menu-level-1"><a href="admin-yifenpeijuese.html">已分配老师的班级</a></div>
			</div>
			
			<div id="qingjia">
				
				<div id="qingjia-left">
					<!-- 左侧蓝条 -->
				</div>
				<div id="qingjia-right">
					<!-- qingjia-right -->
					<div id="qingjia-right-top">
						<!-- qingjia-right-top -->
						
						<div id="qingjia-right-top-top">
							<!-- 顶部蓝条 -->
							已分配班级的用户
						</div>
						<div id="qingjia-right-top-bottom">
							
							<table  class="fenpeijuese" id="classStudentList">
								<tr>
									<td>ID</td>
									<td>姓名</td>
									<td>手机号码</td>
									<td>班级</td>
									
								</tr>
								<tr v-for="student in classStudentList">
									<!-- <td>{{student.userId}}</td> -->
									<td><input type="checkbox" v-bind:id="student.userId" :value="student.userId" v-model="b"/> </td>
									<td>{{student.studentName}}</td>
									<td>{{student.phone}}</td>
									<td>{{student.className}}</td>
							
								</tr>
								<tr>
									
									<td colspan="4"> <input class="fenpei" type="button" value="刪除" id="botton" @click="shanchu()"/></td>
									<!-- <td colspan="4">
										<input class="fenpei" type="button" value="刪除" id="botton" v-on:click="shanchu" />
									</td> -->
								</tr>
							</table>
						</div>
						
							
						
					</div>
					 
				</div>
				      
			</div>
			
		</div>
		
	</body>
	
	<script>
	window.onload=function(){
		var vue=new Vue({
			el:'#classStudentList',
			data:{
				classStudentList:[],
				studetnId:[],
				b:[],
			},
			methods:{
				shanchu(){
					var studetn=this.b;
					console.log(student)
					
					
					// console.log(this.studetnId)
					// console.log(vue.b)
					// var id=this.studetnId
					// var studentId=parseInt(id);
					
					
					var url='http://localhost:8080/kaoqin/clazzStudentTeacher/delete'
					var dates={"userId":[this.b]}
					axios.post(url,datas).then(function(backdatas){
						location.reload();
					})
					
				},
			
			},
			created:async function(){
				// 数据请求
			
				const res = await axios.post('http://localhost:8080/kaoqin/clazzStudentTeacher/findAll')
				console.log(res);
				// 把数据装到rs数组里面
				this.classStudentList = res.data.data
			}
		})
		
	}
		
	
	
	
	
	</script>
	
	
</html>
